package c.e.a.c.l;

import android.graphics.Canvas;
import android.view.View;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.l;
import androidx.recyclerview.widget.RecyclerView.w;
import b.i.j.b;
import java.util.Calendar;

/* compiled from: MaterialCalendar */
public class e extends l {
    public final Calendar a = t.d();
    public final Calendar b = t.d();
    public final /* synthetic */ d c;

    public e(d dVar) {
        this.c = dVar;
    }

    public void g(Canvas canvas, RecyclerView recyclerView, w wVar) {
        if ((recyclerView.getAdapter() instanceof v) && (recyclerView.getLayoutManager() instanceof GridLayoutManager)) {
            v vVar = (v) recyclerView.getAdapter();
            GridLayoutManager gridLayoutManager = (GridLayoutManager) recyclerView.getLayoutManager();
            for (b bVar : this.c.Y.n()) {
                Object obj = bVar.a;
                if (obj != null) {
                    if (bVar.b != null) {
                        this.a.setTimeInMillis(((Long) obj).longValue());
                        this.b.setTimeInMillis(((Long) bVar.b).longValue());
                        int h = vVar.h(this.a.get(1));
                        int h2 = vVar.h(this.b.get(1));
                        View v = gridLayoutManager.v(h);
                        View v2 = gridLayoutManager.v(h2);
                        int i = gridLayoutManager.H;
                        h /= i;
                        h2 /= i;
                        for (i = h; i <= h2; i++) {
                            View v3 = gridLayoutManager.v(gridLayoutManager.H * i);
                            if (v3 != null) {
                                int width;
                                int width2;
                                int top = v3.getTop() + this.c.d0.d.a.top;
                                int bottom = v3.getBottom() - this.c.d0.d.a.bottom;
                                if (i == h) {
                                    width = (v.getWidth() / 2) + v.getLeft();
                                } else {
                                    width = 0;
                                }
                                if (i == h2) {
                                    width2 = (v2.getWidth() / 2) + v2.getLeft();
                                } else {
                                    width2 = recyclerView.getWidth();
                                }
                                Canvas canvas2 = canvas;
                                canvas2.drawRect((float) width, (float) top, (float) width2, (float) bottom, this.c.d0.h);
                            }
                        }
                    }
                }
            }
        }
    }
}
